<template>
	<view class="container">
		<!-- 		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">通用详情页</block>
		</cu-custom> -->

		<view class="bg-top bg-blue">
			<view class="top-box shadow">
				<view class="qh-title text-bold text-blue text-xl">
					<text>处理单据</text>
				</view>
				<view class="cu-list menu">

					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-myfill text-blue"></text>
							<text class="text-black">处理人</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入对长名字" border="none" v-model="form.name" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-mobilefill text-blue"></text>
							<text class="text-black">联系电话</text>
						</view>
						<view class="action">
							<u--input placeholder="请输入联系电话" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>
					<view class="cu-item" style="padding: 0;">
						<view class="content">
							<text class="cuIcon-timefill text-blue  margin-right-xs"></text>
							<text class="text-black">处理时间</text>
						</view>
						<view class="action">
							<u--input placeholder="请选择处理时间" border="none" v-model="form.mobile" inputAlign="right"
								clearable></u--input>
						</view>
					</view>



				</view>

			</view>
			<u-toast ref="uToast"></u-toast>

			<!-- 加入按钮 -->
			<view class="padding-lr flex margin-top-sm" style="justify-content: space-between;">
				<button class="cu-btn bg-blue margin-top-sm lg" @click="submit()" style="width: 46%;">确认提交</button>
				<button class="cu-btn bg-red margin-top-sm lg" style="width: 46%;">重置</button>
			</view>


		</view>
	</view>
</template>

<script>
	// import request from '@/common/request.js';
	export default {
		data() {
			return {
				joinList: [{

					},
					{

					}
				],
				form: {},
				fileList1: [],
				uToastType: {
					type: 'success',
					title: '默认主题',
					message: "单据处理成功",
					// 	iconUrl: '/pages/kwork/list'
					url: '/pages/enterprise/list',
				},
			}
		},
		onShow() {

		},
		onLoad() {

		},
		onReachBottom() {

		},
		onShareAppMessage() {
			return {
				title: '分享'
			}
		},
		methods: {
			submit() {
				let uToastType = this.uToastType
				this.$refs.uToast.show({
					...uToastType,
					complete() {
						uToastType.url && uni.navigateTo({
							url: uToastType.url
						})
					}
				})
				// uni.navigateTo({
				// 	url: '/pages/kwork/list'
				// })
			},
















			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this[`fileList${event.name}`][fileListLen]
					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: 'http://192.168.2.21:7001/upload', // 仅为示例，非真实的接口地址
						filePath: url,
						name: 'file',
						formData: {
							user: 'test'
						},
						success: (res) => {
							setTimeout(() => {
								resolve(res.data.data)
							}, 1000)
						}
					});
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	// .bg-blue {
	// 	background-image: linear-gradient(45deg, #727CFB, #46D0ED);
	
	//     color: #ffffff;
	// }
	.container {
		width: 750rpx;
		color: #333333;

		.bg-top {
			margin-top: -1rpx;
			width: 750rpx;
			height: 320rpx;
			padding-top: 100rpx;
			border-radius: 0 0 20% 20%;

			.top-box {
				width: 700rpx;
				background-color: #FFFFFF;
				margin: 0 auto;
				border-radius: 20rpx;
				padding: 20rpx 30rpx 0rpx;
				position: relative;

				.qh-pic {
					position: absolute;
					right: 64rpx;
					top: -50rpx;
					border-radius: 12rpx;
				}

				.qh-title {
					width: 100%;
					height: 60rpx;
					line-height: 65rpx;
					text-align: center;
					// 	padding-right: 190rpx;
				}

				.bxBox {
					position: relative;
					display: flex;
					/* padding: 0 30rpx; */
					min-height: 100rpx;
					/* background-color: #ffffff; */
					/* justify-content: space-between; */
					align-items: center;
					font-size: 30rpx;
					line-height: 1.6em;
					flex: 1;

					.bxImg {
						display: inline-block;
						margin-right: 10rpx;
						width: 1.6em;
						text-align: center;
					}
				}

			}
		}

		.center-box {
			color: #333333;
			width: 700rpx;
			background-color: #FFFFFF;
			margin: 0 auto;
			border-radius: 20rpx;
			padding: 0rpx 30rpx 0rpx;
			position: relative;
			margin-top: 20rpx;
		}
	}
</style>